package com.yzh.oop3;

/**
 * @author 于振晗
 * @title: Book
 * @description: TODO Book
 * @date 2020年08月28日
 * @path com.yzh.oop3
 */
public class Book implements  Comparable{
    private  String bookName;//书名
    private String author;//作者
    private String publisher;//出版社
    private double price;//
    @Override
    public int compareTo(Object obj) {
        Book other =(Book)obj;
        //return this.bookName.compareTo(other.bookName);//""
        if(this.price>other.price){
            return 1;
        } else if (this.price < other.price) {
            return -1;
        }else{
            return 0;
        }
    }
    public Book(String bookName, String author, String publisher, double price){
        this.bookName = bookName;
        this.author = author;
        this.publisher = publisher;
        this.price = price;
    }
}

